// 设计自定义按钮样式与执行方法
import 'package:flutter/material.dart';

// 关闭VSCode非必要报错
// ignore: must_be_immutable
class MyButton extends StatelessWidget 
  {
    final String text;
    VoidCallback onPressed;
    MyButton({  //设置构造函数必须的条件
      super.key,
      required this.text,
      required this.onPressed,
    });
    @override
    Widget build(BuildContext context) 
      {
        return MaterialButton(   //设置按钮样式
          onPressed: onPressed,
          color: Colors.grey[400],
          shape: RoundedRectangleBorder(  //设置圆角
            borderRadius: BorderRadius.circular(12),
          ),
          child: Text(text),
        );
      }
  }
  